package com.itrip.controller;

import com.itrip.dto.ResponseDTO;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
@ResponseBody
public class ExceptionController {
    @ExceptionHandler(value = {Exception.class})
    public ResponseDTO handleException(Exception e){
        //打印异常信息
        e.printStackTrace();
        return new ResponseDTO(103,"请求异常："+e,null);
    }
}
